﻿using System;
using UnityEngine;

// Token: 0x02000225 RID: 549
public class CameraDynamicGround : MonoBehaviour
{
	// Token: 0x06000B70 RID: 2928 RVA: 0x0005FEFC File Offset: 0x0005E0FC
	private void FixedUpdate()
	{
		base.transform.position = new Vector3(this.followCamera.transform.position.x, this.ground.bounds.max.y, this.followCamera.transform.position.z);
		float num = Mathf.Abs(this.followCamera.transform.position.y - this.ground.bounds.max.y);
		float num2 = 2f * num * Mathf.Tan(this.followCamera.fieldOfView * 0.5f * 0.017453292f) * 0.5f / Mathf.Tan(this.followCamera.fieldOfView * 0.5f * 0.017453292f) * this.followCamera.aspect * this.multiply;
		if (num2 < this.scaleMin)
		{
			num2 = this.scaleMin;
		}
		else if (num2 > this.scaleMax || num2 > 2E+09f)
		{
			num2 = this.scaleMax;
		}
		base.transform.localScale = new Vector3(num2, base.transform.localScale.y, num2);
	}

	// Token: 0x040010AE RID: 4270
	private const float failsafe = 2E+09f;

	// Token: 0x040010AF RID: 4271
	[SerializeField]
	public Camera followCamera;

	// Token: 0x040010B0 RID: 4272
	public Collider ground;

	// Token: 0x040010B1 RID: 4273
	[Range(1f, 1E+09f)]
	public float scaleMin = 1f;

	// Token: 0x040010B2 RID: 4274
	[Range(1.1f, 2E+09f)]
	public float scaleMax = 2E+09f;

	// Token: 0x040010B3 RID: 4275
	[Range(1f, 2000f)]
	public float multiply = 20f;
}
